<template>
    
</template>

<script>
    export default {
        name: "RegisterTemp",
      data(){
          return{
            kindergartenCode:''
        }
      },
      created(){
          this.kindergartenCode=this.getParameterFromUrl("code");
      },
      mounted(){
          this.fetchRegisterCode();
      },
      methods:{
        getParameterFromUrl(val) {
          let uri = window.location.href;
          if (!uri) {
            uri = window.location.search;
          }
          let re = new RegExp("" + val + "=([^&?]*)", "ig");
          return uri.match(re) ? uri.match(re)[0].substr(val.length + 1) : null;
        },
        fetchRegisterCode(){
          this.$http.fetchRegisterCode(this.kindergartenCode).then(resp=>{
            let redirectUrl=resp.data;
            if (!redirectUrl){
              return;
            }
            window.location.href=redirectUrl;
          })
        }
      }
    }
</script>

<style scoped>


</style>
